﻿using Microsoft.AspNetCore.Mvc;

namespace auth.Controllers
{
    public class AuthController : Controller
    {
        [Route("auth/require")]
        public ActionResult Require()
        {
            return Json("require");
        }

        [Route("/auth/authorize")]
        public ActionResult Authorize()
        {
            var username = Request.Query["username"];
            
            if (string.IsNullOrEmpty(username))
            {
                return RedirectToAction("Require");
            }
            else
            {
                return Redirect("/weatherforecast");
            }
            
        }
    }
}